package leoner.multithread3;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import leoner.multithread2.MockService;
import leoner.multithread2.MockServiceImpl;

/**
 * @author kanghui
 *
 */
public class MockController {
	private MockService service;
	private ServiceInvokeHelp help;
	public void invokeAllMethods(){
		List<MethodInvokeInfoBean> infos = new ArrayList<MethodInvokeInfoBean>(4);
		MethodInvokeInfoBean m1 = new MethodInvokeInfoBean(String.class,"m1",service,1,"kang");
		MethodInvokeInfoBean m2 = new MethodInvokeInfoBean(Integer.class,"m2",service,1);
		MethodInvokeInfoBean m3 = new MethodInvokeInfoBean(String.class,"m3",service,1,26,"na");
		infos.add(m1);
		infos.add(m2);
		infos.add(m3);
		Map<String,Object> returnValues = help.getReturnValue(infos);
		
		for(String key : returnValues.keySet()){
			System.out.println("key:"+key+",value:"+returnValues.get(key));
		}
		
	}
	public static void main(String[] args) {
		MockController controller = new MockController();
		MockService service = new MockServiceImpl();
		ServiceInvokeHelp help = new ServiceInvokeHelp();
		controller.setService(service);
		controller.setHelp(help);
		controller.invokeAllMethods();
	}
	public void setService(MockService service) {
		this.service = service;
	}
	public void setHelp(ServiceInvokeHelp help) {
		this.help = help;
	}
	
	
}
